package com.example.springboot_system.Controller;

import com.example.springboot_system.pojo.MedicalRecord;
import com.example.springboot_system.pojo.Patient;
import com.example.springboot_system.pojo.vo.outpatient.MedicalRecordReqVO;
import com.example.springboot_system.service.MedicalExaminationService;
import com.example.springboot_system.service.OutpatientService;
import com.example.springboot_system.serviceImpl.MedicalExaminationServiceImpl;
import com.example.springboot_system.serviceImpl.OutpatientServiceImpl;
import com.example.springboot_system.utils.ResponseResult;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpSession;
import java.text.ParseException;

@Controller
@RequestMapping("/outpatient")
public class OutpatientController {

    @Autowired
    private OutpatientService outpatientService;



    @RequestMapping("/buttonFind")
    @ResponseBody
    public ResponseResult buttonFind(String cardId, Integer outpatientQueueStatus, HttpSession session){
        ResponseResult result = outpatientService.buttonFind(cardId, outpatientQueueStatus,session);
        return result;
    }

    @RequestMapping("/findMedicalRecord")
    @ResponseBody
    public ResponseResult updateTollStatus(String cardId, String prescriptionNum, HttpSession session) {
        ResponseResult result = outpatientService.findMedicalRecord(cardId, prescriptionNum, session);
        return result;
    }


    @RequestMapping("/getCardIdInfo")
    @ResponseBody
    public ResponseResult getCardIdInfor(@Param(value = "cardId") String cardId,
                                         HttpSession session){
        return outpatientService.getCardInfo(cardId,session);
    }

    // 提交更改患者基本信息
    @RequestMapping("/savePatientInfo")
    @ResponseBody
    public ResponseResult savePatientInfo(Patient patient){
        return outpatientService.savePatientInfo(patient);
    }

    // 保存诊断信息
    @RequestMapping("/saveJudgeInfo")
    @ResponseBody
    public ResponseResult saveJudgeInfo(MedicalRecord medicalRecord,HttpSession session){
        return null;
    }

    @RequestMapping("/getMedication")
    @ResponseBody
    public ResponseResult getMedication(){
        return outpatientService.getMedication();
    }

    @RequestMapping("/getMedicationInfo")
    @ResponseBody
    public ResponseResult getMedicationInfo(String medicationName){
        return outpatientService.getMedicationInfo(medicationName);
    }

    @RequestMapping("/addMedicalRecord")
    @ResponseBody
    public ResponseResult addMedicalRecord(HttpSession session, MedicalRecordReqVO medicalRecordReqVO){
        return outpatientService.addMedicalRecord(session,medicalRecordReqVO);
    }
}
